package com.buba.commodity.controller;

import com.buba.commodity.pojo.ProductBland;
import com.buba.commodity.service.BlandService;
import com.buba.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/BlandController")
public class BlandController {
    private BlandService blandService;

    /**
     * 查询商品品牌方法
     * @param map
     * @return
     */
    @RequestMapping("/selBland")
    public Page<ProductBland> selBland(@RequestParam Map<String,Object> map){
        Page<ProductBland> page = new Page<>(Long.parseLong(map.get("pageNow").toString()));
        map.put("page",page);
        page.setTotalCount(blandService.selBlandCount(map));
        page.setList(blandService.selBland(map));
        return page;
    }


    @Autowired
    @Qualifier("blandServiceImpl")
    public void setBlandService(BlandService blandService) {
        this.blandService = blandService;
    }
}
